<?
/*------------------------------------------------------------------------------

 Fichier  : alliance_donner.php
 Objet    : page permettant d'effectuer un don de lorins vers une alliance
 Auteur   : RanTanPlan
 Revue    : 03-01-2005
      
--------------------------------------------------------------------------------
 Special  : 
      Ancien fichier invite_alliance
------------------------------------------------------------------------------*/
$tmppath = "../../";
REQUIRE ($tmppath."include/login.php");
REQUIRE ($tmppath."$templates/up.php");
REQUIRE ($tmppath."protect/connect.php");
REQUIRE ("../fonction.php");
REQUIRE ("alliance_inc.php");

// Nom de l'alliance
//--
$query    = "SELECT perso_lorin FROM sduser_perso WHERE perso_id=$userperso";
$resultat = mysql_query($query);
$row      = mysql_fetch_array($resultat);
$lorin    = $row[0];

TITRE_JEU("Effectuer un don");

?>
<script language="JavaScript" type="text/JavaScript">
<!--

function PlusDon(){
	var bourse = eval(document.alliance_donner.bourse.value);
	var don    = eval(document.alliance_donner.don.value);
	
	if (bourse>=100){
		document.alliance_donner.don.value    = don+100;
		document.alliance_donner.bourse.value = bourse-100;
	}
}

function MoinsDon(){
	var bourse = eval(document.alliance_donner.bourse.value);
	var don    = eval(document.alliance_donner.don.value);
	
	if (don>=100){
		document.alliance_donner.don.value    = don-100;
		document.alliance_donner.bourse.value = bourse+100;
	}
}
/* Fin javascript */
-->
</script>
  <div align="center">
    <table width="75%" border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="black">
      <tr> 
        <td width="100%" class="td3"> 
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td align="center"><b><em><font color="#FFFF00" size="4">Saisie de la somme</font></em></b></td>
            </tr>
          </table>
        </td>
      </tr>
      <tr> 
        <td class="td2" align="right"> 
          <table width="75%" border="0" align="center" cellspacing="0">
            <tr>
              <td align="center">
                <form name="alliance_donner" method="post" action="traitement.php">
                  <p>
						        <table width="75%" border="0" align="center" cellspacing="0">
						          <tr>
						            <td align="right" ><? libel("Lorins disponibles : "); ?></td>
						            <td align="center" colspan="3"><input name="bourse" type="text" id="bourse" value="<? echo "$lorin"; ?>" size="15" maxlength="15" READONLY></td>
						          </tr>
						          <tr>
						            <td width="45%" align="right"><? libel("Somme : "); ?></td>
						            <td width="10%" align="right"><input type="button" name="BtnPlus" value="+100"  onClick="PlusDon()" onKeyPress="PlusDon()" ></td>
						            <td width="35%" align="center"><input name="don" type="text" id="don" size="15" maxlength="15" value="0" READONLY></td>
						            <td width="10%" align="left"><input type="button" name="BtnMoins" value="-100"  onClick="MoinsDon()" onKeyPress="MoinsDon()" ></td>
						          </tr>
						        </table>
                  </p>
<?
echo"<input name=\"$SID\" type=\"hidden\" id=\"$SID\" value=\"$SID\">";
echo"<input name=\"mode\" type=\"hidden\" id=\"mode\" value=\"alliance_donner\">";
echo"<input name=\"userperso\" type=\"hidden\" id=\"userperso\" value=\"$userperso\">"; 
echo"<input name=\"name\" type=\"hidden\" id=\"name\" value=\"$nom\">"; 
echo"<input name=\"alliance\" type=\"hidden\" id=\"alliance\" value=\"$alliance\">";
?>								
                  <p>
                    <input type="submit" name="Submit" value="Envoyer">
                  </p>
                </form>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    <br/>
  </div>
<? LIGNE_SEPARATRICE(); ?>
</body>
</html>
